/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model.DAO;

import Model.Beans.Question;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.FetchMode;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Pashi
 */
public class QuestionDAO extends AbstracDAO<Question>{
        public Question getQuestion(int idQuestion){
            Question question;
            session = HibernateUtil.getSessionFactory().openSession();
            Criteria bookCri = session.createCriteria(Question.class);
            bookCri.setFetchMode("answers", FetchMode.JOIN);
            bookCri.add(Restrictions.eq("idquestion", idQuestion));
            question = (Question) bookCri.uniqueResult();
            session.close();
            return question;
        }
}
